Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add O2 linter #7066

Draft
wants to merge 72 commits into
base: master
Choose a base branch
from
Draft

Add O2 linter #7066

wants to merge 72 commits into from

Conversation

vkucera
Copy link
Collaborator

@vkucera vkucera commented Jul 30, 2024

Adds a GitHub action that runs a script that checks for O2-specific issues in the code.
The script can run standalone, taking paths of files as arguments.
When running in the GitHub action on the pull_request event, the script tests files modified by the PR and generates error messages as GitHub annotations which appear as comments on the relevant lines or at the top of the file in case of per-file tests.
When running in the GitHub action on the push event, the script tests files modified in the branch w.r.t. the main branch and does not produce annotations.
False positives should be rare but, if any, they can be silenced per line for most of the tests by adding a comment in a given format.

Implements the following tests.

Bad practice:

  • included iostream
  • importing names from the std namespace
  • using directives in headers
  • missing std:: prefix for common names from the std namespace
  • unnecessary use of ROOT entities
  • use of external pi
  • adding/subtracting of 2 pi
  • multiples/fractions of pi for existing equivalent constants
  • use of TDatabasePDG
  • use of hard-coded PDG codes
  • unnecessary call of Mass() for a known PDG code
  • non-O2 logging
  • not using const refs in range-based for loops
  • not using const refs in process function subscriptions
  • usage of workflow options in defineDataProcessing

Documentation:

  • mandatory documentation of C++ files

Naming conventions:

  • functions
  • variables
  • macros
  • constexpr constants
  • namespaces
  • defined types
  • enumerators
  • classes
  • structs
  • O2 columns
  • O2 tables
  • O2 workflows
  • explicit task names
  • C++ files
  • Python files

PWG-HF specific conventions:

  • PWGHF: swapped const auto
  • PWGHF: names of structs and classes
  • PWGHF: order of struct members
  • PWGHF: names of workflow files
  • PWGHF: names of configurables

@vkucera vkucera marked this pull request as ready for review July 30, 2024 13:01
Copy link

This PR has not been updated in the last 30 days. Is it still needed? Unless further action is taken, it will be closed in 5 days.

@github-actions github-actions bot added the stale label Sep 14, 2024
@vkucera vkucera removed the stale label Sep 14, 2024
@vkucera vkucera marked this pull request as draft September 19, 2024 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant